//index.js
//获取应用实例
var app = getApp();
var WxParse = require('../../wxParse/wxParse.js');

Page({
  data: {
    autoplay: true,
    interval: 3000,
    duration: 1000,
    goodsDetail:{},
    swiperCurrent: 0,  
    hasMoreSelect:false,
   
    shopNum:0,
    hideShopPopup:true,

    propertyChildIds:"",
    propertyChildNames:"",
    shopCarInfo:{},
    modalContent:"",
    modalHidden:true
  },

  //事件处理函数
  swiperchange: function(e) {
      //console.log(e.detail.current)
       this.setData({  
        swiperCurrent: e.detail.current  
    })  
  },
  onLoad: function (e) {
    var that = this;
   
    wx.request({
      url: app.globalData.surl +'wx-cms/getGoodsDetail',
      data: {
        key: e.id
      },
      success: function(res) {
        
        if (res.data.ok) {
          that.data.goodsDetail = res.data.data;
          that.setData({
            goodsDetail: res.data.data
          });
          WxParse.wxParse('article', 'html', res.data.data.remark, that, 15);
        }else{
          wx.showModal({
            title: '失败',
            content: '查询商品失败',
          })
        }
        
      }
    })


  },
  bindGuiGeTap: function() {
     this.setData({  
        hideShopPopup: false 
    })  
  },
  closePopupTap: function() {
     this.setData({  
        hideShopPopup: true 
    })  
  },
  numJianTap: function() {
  },
  numJiaTap: function() {
  },
  onShareAppMessage: function () {
    return {
      title: this.data.goodsDetail.basicInfo.name,
      path: '/pages/goods-details/index?id=' + this.data.goodsDetail.basicInfo.id,
      success: function (res) {
        // 转发成功
      },
      fail: function (res) {
        // 转发失败
      }
    }
  }
})
